<?php
/**
 * Created by PhpStorm.
 * User: shkj
 * Date: 2020/5/7
 * Time: 23:29
 */

namespace app\api\controller\v1;
use think\facade\Request;
use app\api\model\Cart;
use think\Db;
class My extends Base
{


    protected $beforeActionList = [
       'vali'
        //第一个''写前置方法的名字 ，后是需要用到前置方法的名字
    ];
       private $obj;

        protected function vali(){
        
        $data = Request::param();

        $token = Request()->header('Token');


        if(isset($data['uid'])&&!empty($data['uid'])&&$data['uid'] != 'undefined' && !empty($token)){
            $uid = $data['uid'];
            $status = $this->verifyToken($uid,$token);
        
              if($token && $status){
                $this->obj = model("order");
        }
    }else{
            return_json(40001,'token过期了',40001);
                    }

        }

    public function select(){
        $data = Request::post();
        $uid = $data['uid'];
       
        if(!isset($data['type'])){
            $data['type'] = 1;
        }
        $type = $data['type'];

        $this->obj->select($uid,$type);
      
 
    }

    public function detail(){
        $id = Request::param('id');
        $this->obj->detail($id);
    }

    public function coupons(){
         $uid = Request::param('uid');
         model('coupons')->detail($uid);
    }

    public function evaluation(){
        $data = Request::param();
        dump($data);
    }

  

  
    


}